package com.simtop;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.extra.tokenizer.Result;
import cn.hutool.extra.tokenizer.TokenizerEngine;
import cn.hutool.extra.tokenizer.TokenizerUtil;
import cn.hutool.extra.tokenizer.Word;

import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;

/**
 * @ClassName: MakeSf
 * @Description TODO
 * @Author liuzhaobo
 * @Date 2022/10/10 0010 9:20
 * @Version 1.0
 **/
public class MakeSfz {

    public static void main(String[] args) {
        TimeInterval timer = DateUtil.timer();

        // "摩羯座"
        String zodiac = DateUtil.getZodiac(1, 18);
        Console.log(zodiac);

// "狗"
        String chineseZodiac = DateUtil.getChineseZodiac(1998);
        Console.log(chineseZodiac);

        String Id_s = "410721199801183511";
        boolean valid = IdcardUtil.isValidCard(Id_s);
        Console.log(valid);
        String province = IdcardUtil.getProvinceByIdCard(Id_s);
        Console.log(province);

        //年龄
        DateTime date = DateUtil.parse("2022-10-10");

        int age = IdcardUtil.getAgeByIdCard(Id_s, date);
        Console.log(age);
        Date dates = DateUtil.date();
        Console.log(dates);
        Date date1 = new Date();
        Console.log(date1);
        Date date3 = DateUtil.date(System.currentTimeMillis());
        Console.log(date3);
        String now = DateUtil.now();
        Console.log(now);
        String date2 = String.valueOf(new Date());
        System.out.println(date2);
        String today = DateUtil.today();
        Console.log(today);
        String dateStr = "2017-03-01";
        Date datess = DateUtil.parse(dateStr);
        Console.log(datess);
        String dateStr2 = "Mon Oct 10 13:38:02 CST 2022";
        Date datess2 = DateUtil.parse(dateStr2);
        Console.log(datess2);

        long interval = timer.interval();//花费毫秒数
        Console.log(interval);

        //自动根据用户引入的分词库的jar来自动选择使用的引擎
        TokenizerEngine engine = TokenizerUtil.createEngine();

//解析文本
        String text = "大家好啊你好无敌刘昭博自动分词古今中外";
        Result result = engine.parse(text);
//输出：这 两个 方法 的 区别 在于 返回 值
        String resultStr = CollUtil.join((Iterator<Word>) result, " ");
        Console.log(resultStr);
        String[] s = resultStr.split(" ");
        ArrayList<Object> objects = new ArrayList<>();
        for (String as:s
             ) {
            System.out.println(as);
            objects.add(as);
        }
        Console.log(objects);

    }


}
